
#include<stdio.h>

int
cpu_get_socket_num_low(
    char*          cpu_path,
    char*          cpu_flag,
    int           flag_len
)
{
    int        socket = 0;
    int        tmp_v;
    FILE*       fp = NULL;
    char       buf[2049];
    char*		p = NULL;

    fp = fopen(cpu_path,"rt");
    if(!fp)
    {
        perror("fopen error");
        return 0;
    }

    do
    {
        memset(buf,0,2049);
        fgets(buf,2048,fp);
		if(!strncasecmp(buf, cpu_flag, flag_len))
        {
             p = strchr(buf, ':');
             if (p != 0)
             {
                 tmp_v = atoi(p + 1);
                 if (socket < tmp_v)
                     socket = tmp_v;
             }
        }
    }while(!feof(fp));

    fclose(fp);

    return socket + 1;
}

void main(){

#if defined(FEITENG) || defined(ARM_CPU) || defined(FEITENG_CPU)
    printf("printf: %s\n","Any Cpus");
#elif defined(MIPS) || defined(LOONGSON_CPU)
    printf("printf: %s\n","Any Cpus");
#elif defined(SHENWEI) || defined(SHENWEI_CPU)
    printf("printf: %s\n","Any Cpus");
#else
    printf("printf: %s\n","Not Any Cpus!");
#endif
int        socket = 0;
socket = cpu_get_socket_num_low("/proc/cpuinfo", "physical id", 11);
printf("printf: %u\n",socket);

printf("printf: %s\n",'12');
    return 0;
}



